<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<div class="form-group">
		<table style="word-break: break-all; word-wrap: break-all;"
			class="table table-hover table-condensed table-responsive">
			<thead>
				<tr>
					<th style='width: 60px'>Id</th>
					<th style='width: 100px'>用例名称</th>
					<th>URL</th>
					<th style='width: 80px'>方法</th>
					<th style='width: 100px'>期望输出</th>
					<th style='width: 60px'>次数</th>
					<th>状态</th>
					<th style='width: 90px'>创建人</th>
					<th style='width: 120px'>调用时间</th>
					<th style='width: 60px'>操作</th>
					<th>执行测试</th>
				</tr>
			</thead>
			<tbody>
				#foreach ($t in $httpapis)
				<tr>
					<td>$!t.id</td>
					<td>$!t.name</td>
					<td>$!t.url</td>
					<td>$!t.method</td>
					<td>$!t.expectOutput</td>
					<td>$!t.runTimes</td> #if($!t.state==1)
					<td><div class="btn btn-success">成功</div></td>
					#elseif($!t.state==0)
					<td><div class="btn btn-danger">失败</div></td> #else
					<td><div class="btn btn-info">未执行</div></td> #end
					<td>$!t.owner</td>
					<td>$!DateTool.format('yyyy-MM-dd HH:mm:ss', $!t.gmtModify)</td>
					<td><a href="/httpapi/detailPage/$t.id">查看</a></td>
					<td><div id='btn-$t.id' class='btn btn-primary'
							onclick='runTest($t.id)'>运行</div></td>
				</tr>
				#end
			</tbody>
		</table>
	</div>

	<script>
		function runTest(id) {
			var url = '/httpapi/runTest?id=' + id
			$.getJSON(url, function(data) {
				if (data) {
					alert('响应结果:' + JSON.stringify(data, null, 2))
					location.reload()
				} else {
					alert('执行失败')
				}
			})
		}
	</script>
</body>
</html>